//index.js
//获取应用实例
const app = getApp()
Page({
  data: {
    indicatordots: true,
    autoplay: true,
    banner:[],
    nominate:[],
    festival: [],
    status:true,
    tologin:true,
  },
  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  cardHandle: function (e) {
    var that = this;
    wx.navigateTo({
      url: '/pages/card/card?id=' + e.currentTarget.id 
    })
  },
  onLoad: function () {
     
  },
  onGotUserInfo:function(){
    var that = this;
    app.onGotUserInfo();
    that.setData({
      tologin: true,
      status:false
    })
    app.siteinfo.islogin = true;
  },
  onShow:function(){
    var that = this;
    wx.request({
      url: app.siteinfo.rootpath +'index',
      method:"get",
      data:{},
      success:function(res){
        that.setData({
          banner: res.data.banner,
          nominate: res.data.nominate,
          festival: res.data.festival,
        })
      }

    })
    wx.removeStorageSync('music')
    wx.removeStorageSync('greet')
    wx.removeStorageSync('requestdata')
  },

  loginHandle: function() {
    let that = this
    that.setData({
      status:false
    })
  },
  onShareAppMessage:function(){
    var that = this;
    that.setData({
      tologin: app.siteinfo.islogin
    })
    var status = that.data.status
    var tologin = that.data.tologin
    if (!tologin) {
      if (!status) {
        that.setData({
          status: true
        })

      }
      return;
    }
    return {
      title: '贺卡送祝福，欢喜度新年',
      path: '/pages/index/index',
      success(e) {
        console.log(123)
      },
      fail(e){
        console.log(444)
      }
    }
  }
})
